<template>
    <div class="content" v-loading="load">
        <el-form>
            <el-form-item label="类型">
                <el-input type="text" v-model="type.type"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="save()">保存</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>

<script setup lang="ts">

import { reqGetFloorList, reqaddBookType } from '@/api/common';
import { TypeListType } from '@/types/book';
import { FloorType } from '@/types/floor';
import { tip } from '@/utils/alert';
import { onMounted, ref } from 'vue';

const load=ref<boolean>(false)

const emits=defineEmits(['emitAdd'])
const type=ref<TypeListType>({
    type:"",
    fid:-1
})




const floorList=ref<FloorType[]>([])

const save=()=>{
    console.log(type.value);
    reqaddBookType(type.value).then(res=>{
        tip(res.data.info,"success")
        emits('emitAdd',false)
        console.log(res);
    })
    
}



</script>

<style lang="scss" scoped>
.content {
    width: 50%;

    .el-button {
        width: 100%;
    }

    .imgBox {
        .avatar-uploader {
            height: 250px;
            width: 200px;
            border: 1px dashed var(--el-border-color);
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;

            img {
                width: 200px;
                height: 250px
            }
        }
    }
}</style>